package cn.lg.soar.system.biz.modules.general.service.impl;

import cn.lg.soar.system.biz.config.SystemCacheKey;
import cn.lg.soar.system.biz.modules.general.entity.FileUploadInfo;
import cn.lg.soar.system.biz.modules.general.mapper.FileUploadInfoMapper;
import cn.lg.soar.system.biz.modules.general.service.IFileUploadInfoService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * 业务附件
 * @author luguoxiang
 * @since 2024-06-02
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Service
public class FileUploadInfoServiceImpl extends ServiceImpl<FileUploadInfoMapper, FileUploadInfo> implements IFileUploadInfoService {

    @Cacheable(value = SystemCacheKey.UPLOAD_INFO, key = "#p0")
    @Override
    public FileUploadInfo getById(Serializable id) {
        return super.getById(id);
    }

    @Override
    public FileUploadInfo getByCode(String code) {
        return getOne(
                Wrappers.<FileUploadInfo>lambdaQuery().eq(FileUploadInfo::getCode, code)
        );
    }

}
